// 定义基准字体

new function() {
  var _self = this;
  _self.width = 750; //设置默认最大宽度
  _self.fontSize = 100; //默认字体大小
  _self.widthProportion = function() {
    var _dom =
      ((document.body && document.body.clientWidth) ||
        document.getElementsByTagName("html")[0].offsetWidth) / _self.width;
    return _dom;
  };
  _self.changePage = function() {
    document
      .getElementsByTagName("html")[0]
      .setAttribute(
        "style",
        "font-size:" + _self.widthProportion() * _self.fontSize + "px"
      );
  };
  _self.changePage();
  window.addEventListener(
    "resize",
    function() {
      _self.changePage();
    },
    false
  );
}();




//滚动条是否在顶部
var isScroll_top = true;
//滚动条是否在底部
var isScrill_bottom = false;
function restoreEvent(event) {
    switch(event.type){
        case "touchstart" :
            $startY = event.touches[0].clientY;
            break;
        case "touchmove" :
            $moveY = event.touches[0].clientY;
            //滑动距离
            touchesY = $startY - $moveY;
            //滚动条顶部
            if(isScroll_top) {
                if(touchesY < 0) {
                    event.preventDefault();
                }else{
                    var scrollWrap = document.getElementById("scrollWrap");
                    if(scrollWrap.scrollHeight == scrollWrap.clientHeight) {
                        event.preventDefault();
                    }else {
                        event.stopPropagation();
                    }
                }
            //滚动条底部
            }else if(isScrill_bottom){
                if(touchesY > 0) {
                    event.preventDefault();
                }else{
                    event.stopPropagation();
                }
            }
            break;
        case "touchend" :
            break;
    }
}
